<template>
	<view>
		<view class="box">
			<view class="userinfoBox">
				<image class="userIcon" :src="avatar"></image>
				<view class="infoBox">
					<view class="nameBox">
						<view class="name">
							{{name}}
						</view>
						<!-- <image class="alter" src="../../static/images/minde/address.png"></image> -->
					</view>
					<view class="sexBox">
						ID:{{id}} 丨 <text v-if="sex==1">男</text><text v-else-if="sex==2">女</text><text v-else>保密</text>
					</view>
				</view>
			</view>
		</view>
		<view class="otherBox">
			<view class="title">
				进货订单
			</view>
			<view class="iconBox">
				<view class="icon" @click="toOrder(1)">
					<view class="bugIcon" v-show="replenNumber.allCount">
						{{replenNumber.allCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order1.png">
					</image>
					<view class="iconTitle">
						全部
					</view>
				</view>
				<view class="icon margins" @click="toOrder(3)">
					<view class="bugIcon" v-show="replenNumber.deliveredCount">
						{{replenNumber.deliveredCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order2.png"></image>
					<view class="iconTitle">
						待收货
					</view>
				</view>
				<view class="icon margins" @click="toOrder(4)">
					<view class="bugIcon" v-show="replenNumber.completedCount">
						{{replenNumber.completedCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order3.png"></image>
					<view class="iconTitle">
						已收货
					</view>
				</view>
				<view class="icon margins" @click="toOrder(5)">
					<view class="bugIcon" v-show="replenNumber.afterSaleCount">
						{{replenNumber.afterSaleCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order4.png"></image>
					<view class="iconTitle">
						售后
					</view>
				</view>
			</view>
		</view>
		<view class="otherBox">
			<view class="title">
				店铺订单
			</view>
			<view class="iconBox">
				<view class="icon" @click="toStOrder(1)">
					<view class="bugIcon" v-show="countNumer.allCount">
						{{countNumer.allCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order1.png">
					</image>
					<view class="iconTitle">
						全部
					</view>
				</view>
				<view class="icon margins" @click="toStOrder(2)">
					<view class="bugIcon" v-show="countNumer.undeliveredCount">
						{{countNumer.undeliveredCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order2.png"></image>
					<view class="iconTitle">
						待接单
					</view>
				</view>
				<view class="icon margins" @click="toStOrder(3)">
					<view class="bugIcon" v-show="countNumer.deliveredCount">
						{{countNumer.deliveredCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order3.png"></image>
					<view class="iconTitle">
						已接单
					</view>
				</view>
				<view class="icon margins" @click="toStOrder(5)">
					<view class="bugIcon" v-show="countNumer.afterSaleCount">
						{{countNumer.afterSaleCount}}
					</view>
					<image class="iconImage" src="@/static/images/work/order4.png"></image>
					<view class="iconTitle">
						售后
					</view>
				</view>
			</view>
		</view>
		<view class="otherBox padding_b">
			<view class="title">
				更多功能
			</view>
			<view class="otherLi" @click="toMyMeal">
				<image class="otherImg" src="@/static/images/work/meal2.png"></image>
				<view class="otherTxt">
					我的套餐
				</view>
			</view>
			<view class="otherLi" @click="toStock">
				<image class="otherImg" src="@/static/images/work/stock.png"></image>
				<view class="otherTxt">
					商品库存
				</view>
			</view>
			<view class="otherLi" @click="toNotes">
				<image class="otherImg" src="@/static/images/work/table2.png"></image>
				<view class="otherTxt">
					桌牌申请记录
				</view>
			</view>
			<view class="otherLi" @click="toAddress">
				<image class="otherImg" src="@/static/images/work/address.png"></image>
				<view class="otherTxt">
					地址管理
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		myCount
	} from "@/api/stOrder/stOrder.js"
	import {
		getCount
	} from "@/api/wine/wine.js"
	export default {
		name: "workMine",
		data() {
			return {
				countNumer: {}, //店铺数量
				replenNumber: {}, //补货数量
				id: 0,
				sex: 0,
				name: '',
				avatar:''
			};
		},
		created() {
			this.getNumber()
			this.avatar = this.$store.getters.avatar
			// console.log('touxiang',this.avatar)
			let id = this.$store.getters.id
			if (id) {
				this.id = id
			}
			let sex = this.$store.getters.sex
			if (sex) {
				this.sex = sex
			} else {
				this.sex = 3
			}
			this.name = this.$store.getters.name
		},
		methods: {
			//获得店铺订单数量
			getNumber() {
				let that = this
				// uni.showLoading({
				// 	title:'加载中',
				// 	mask:true
				// })
				myCount().then(response => {
					if (response.code == 0) {
						// uni.hideLoading()
						that.countNumer = response.data
					}
				})
				getCount({
				}).then(response => {
					if (response.code == 0) {
						// uni.hideLoading()
						that.replenNumber = response.data
					}
				})
			},
			//跳转进货订单
			toOrder(e) {
				this.$tab.navigateTo('/pagesA/replenOrder/replenOrder?type=' + e)
			},
			//跳转申请记录
			toNotes() {
				this.$tab.navigateTo('/pagesA/tableNotes/tableNotes')
			},
			//跳转我的套餐
			toMyMeal() {
				this.$tab.navigateTo('/pagesA/myMeal/myMeal')
			},
			//跳转店铺订单
			toStOrder(e) {
				this.$tab.navigateTo('/pagesA/stOrder/stOrder?type=' + e)
			},
			//跳转库存
			toStock() {
				this.$tab.navigateTo('/pagesA/stock/stock')
			},
			//跳转地址管理
			toAddress() {
				this.$tab.navigateTo('/pagesA/address/address')
			}
		}
	}
</script>

<style>
	.box {
		width: 750rpx;
		height: 406rpx;
		background-color: #fff;
		overflow: hidden;
	}

	.userinfoBox {
		width: 690rpx;
		height: 160rpx;
		margin: 210rpx auto 0 auto;
		display: flex;
		justify-content: space-between;
	}

	.userIcon {
		width: 160rpx;
		height: 160rpx;
		border-radius: 50%;
		overflow: hidden;
		background-color: #999999;
	}

	.infoBox {
		width: 500rpx;
		height: 160rpx;
	}

	.nameBox {
		width: 500rpx;
		height: 50rpx;
		margin: 38rpx auto 0 auto;
		line-height: 50rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}

	.name {
		max-width: 410rpx;
		height: 50rpx;
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.alter {
		width: 28rpx;
		height: 28rpx;
		margin-left: 20rpx;
	}

	.sexBox {
		width: 500rpx;
		height: 50rpx;
		line-height: 50rpx;
		margin: 0 auto;
		font-size: 20rpx;
		color: #999999;
	}

	.otherBox {
		width: 690rpx;
		min-height: 250rpx;
		background: #FFFFFF;
		margin: 30rpx auto 0 auto;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		overflow: hidden;
	}

	.title {
		width: 630rpx;
		height: 50rpx;
		line-height: 50rpx;
		margin: 30rpx auto;
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
	}

	.iconBox {
		width: 590rpx;
		height: 120rpx;
		margin: 0 auto;
		display: flex;
	}

	.icon {
		width: 100rpx;
		height: 120rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		align-items: center;
		position: relative;
	}

	.iconImage {
		width: 64rpx;
		height: 64rpx;
	}

	.bugIcon {
		min-width: 30rpx;
		height: 30rpx;
		text-align: center;
		line-height: 30rpx;
		font-size: 20rpx;
		color: white;
		border-radius: 15rpx;
		background-color: red;
		position: absolute;
		top: 0;
		right: 0;
	}

	.iconTitle {
		width: 120rpx;
		height: 40rpx;
		font-size: 28rpx;
		color: #333333;
		text-align: center;
	}

	.margins {
		margin-left: 60rpx;
	}

	.otherLi {
		width: 630rpx;
		height: 108rpx;
		border-bottom: 2rpx solid #F1F1F1;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.otherLi:last-child {
		border: none;
	}

	.otherImg {
		width: 48rpx;
		height: 48rpx;
	}

	.otherTxt {
		width: 550rpx;
		height: 108rpx;
		line-height: 108rpx;
		font-weight: 400;
		font-size: 28rpx;
		color: #333333;
	}

	.padding_b {
		padding-bottom: 30rpx;
	}
</style>